import App from '../App'
import { createBrowserRouter } from 'react-router-dom'
import { lazy } from 'react'


const Data = lazy(() => import('@/page/data/Index'))
const Home = lazy(() => import('@/page/home/Index'))
const Ss = lazy(() => import('@/page/ss/Index'))
const Book = lazy(() => import('@/page/book/Index'))
const Look = lazy(() => import('@/page/look/Index'))
const Looks = lazy(() => import('@/page/looks/Index'))

// export const routerItem = [
//     {
//         path: '/home/data',
//         element: <Data />,
//         title: '首页'
//     },
//     {
//         path: '/home/ss',
//         element: <Ss />
//     },
//     {
//         path: '/home/book',
//         element: <Book />
//     },
//     {
//         path: '/home/look',
//         element: <Look />
//     },
//     {
//         path: '/home/looks',
//         element: <Looks />
//     },
// ]

// const routes = createBrowserRouter([
//     {
//         path: '/',
//         element: <App />,
//         children: [
//             {
//                 path: '/home',
//                 element: <Home />,
//                 children: routerItem
//             }
//         ]
//     }
// ])

// export default routes

type routesType = {
    path: string,
    element: JSX.Element,
    children: { path: string, element: JSX.Element, }[]
}[]

//一级路由
const routes: routesType = [
    {
        path: '/',
        element: <App />,
        children: [
            {
                path: '/home',
                element: <Home />,

            },
            {
                path: '/data',
                element: <Data />
            },
            {
                path: '/ss',
                element: <Ss />
            },
            {
                path: '/book',
                element: <Book />
            },
            {
                path: '/look',
                element: <Look />
            },
            {
                path: '/looks',
                element: <Looks />
            },
        ]
    }
]
const router = createBrowserRouter(routes)
export default router